{template member/header}
<link href="{ADMIN_THEME}images/table_form.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/dialog.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{ADMIN_THEME}js/dialog.js"></script>
<script type="text/javascript">var sitepath = "{SITE_PATH}{ENTRY_SCRIPT_NAME}";</script>
<script type="text/javascript" src="{LANG_PATH}lang.js"></script>
<script type="text/javascript" src="{ADMIN_THEME}js/core.js"></script>
<!--Wrapper-->
<div id="wrapper">
	<div class="top"></div>
	<div class="center">
	    <div class="center_left">
	        <h3>资料信息</h3>
			<div class="menu_left">
			<ul>
            {loop $navigation $n=>$t}
                <li {if $n==$a} class="on"{/if}><a href="{$t['url']}">{$t['name']}</a></li>
            {/loop}
			</ul>
			</div>
        </div>
		<div class="center_right">
            <div class="title_right1"></div>
			<div class="content_info">
                {if $memberconfig['uc_use']}
				<table width="100%" class="table_form ">
				<tbody>
				<tr>
					<th align="left" id="myContent">
                    <h1>头像保存后，您可能需要刷新一下本页面(按F5键)，才能查看最新的头像效果</h1><br>
			        {uc_avatar($memberinfo['uid'])}
					</th>
					<td width="210"align="left" valign="top">
					{if uc_check_avatar($memberinfo['uid'])}
					<div class="avatar"><img src="{UC_API}/avatar.php?uid={$memberinfo['uid']}&size=big"></div>
					<div class="avatar"><img src="{UC_API}/avatar.php?uid={$memberinfo['uid']}&size=middle"></div>
					<div class="avatar"><img src="{UC_API}/avatar.php?uid={$memberinfo['uid']}&size=small"></div>
					{else}
				    <div class="avatar"><img src="{get_member_avatar($memberinfo['uid'])}"></div>
					{/if}
					</td>
				</tr>
				</tbody>
				</table>
			    {else}
                {if empty($memberconfig['avatar'])}
				<form action="" method="post">
				<table width="100%" class="table_form ">
				<tbody>
				<tr>
					<th width="100">会员名称：</th>
					<td>{$memberinfo['username']}</td>
				</tr>
				<tr>
				  <th>缩略图：</th>
				  <td><input type="text" class="input-text" size="50" value="{$memberinfo['avatar']}" name="data[avatar]" id="thumb">
				  <input type="button" style="width:66px;cursor:pointer;" class="button" onClick="preview('thumb')" value="预览图片">
				  <input type="button" style="width:66px;cursor:pointer;" class="button" onClick="uploadImage('thumb', 90, 90)" value="上传图片">
				  </td>
				</tr>
				 <tr>
					<th style="border:none">&nbsp;</th>
					<td style="border:none"><input type="submit" class="button" value="保 存" name="submit"></td>
				</tr>
				</tbody>
				</table>
				</form>
                {else}
				<script src="{$avatar_ext_path}iscroll-zoom.js"></script>
				<script src="{$avatar_ext_path}hammer.js"></script>
				<script src="{$avatar_ext_path}lrz.all.bundle.js"></script>
				<script src="{$avatar_ext_path}jquery.photoClip.js"></script>
				<style>

					#clipArea {
						margin: 20px;
						height: 300px;
					}
					#file {
						width: 60px;
						height: 30px;
						position: relative;
						top: -30px;
						opacity: 0;
						direction: ltr;
					}
					#clipBtn {
						float: left;margin: 0;padding: 0; margin-left: 20px;
						text-align: center;
					}
					#view {
						margin-bottom: 70px;
					}
					.fileinput {
						text-align: center;
						float: left;margin: 0;padding: 0; margin-left: 20px;
					}
				</style>

				<table width="100%" class="table_form">
				<tbody>
				<tr>
					<th align="left" width="500" style="padding:0px;margin:0px;">

						<div id="clipArea"></div>

						<div id="view">

							<div class=" btn btn-info fileinput fileinput-new" data-provides="fileinput">
								选择图片
								<input type="file" id="file">
							</div>
							<button type="button" class="btn btn-info" id="clipBtn"> 保存头像</button>
						</div>

						<script>
							var clipArea = new bjj.PhotoClip("#clipArea", {
								size: [200, 200],
								outputSize: [200, 200],
								file: "#file",
								view: "#view",
								ok: "#clipBtn",
								loadStart: function() {
									console.log("照片读取中");
								},
								loadComplete: function() {
									console.log("照片读取完成");
								},
								clipFinish: function(dataURL) {
									$.ajax({type: "POST",dataType:"text", url: "{$avatar_return}", data: dataURL,
										success: function(text) {
											alert(text);
											//setTimeout("window.location.reload(true)", 2000)
										},
										error: function(HttpRequest, ajaxOptions, thrownError) {
											alert(HttpRequest.responseText);
										}
									});
								}
							});
						</script>

					</th>
					<td align="left" valign="top">
				   		<div class="avatar"><img src="{image($memberinfo['avatar'])}"></div>
					</td>
				</tr>
				</tbody>
				</table>
                {/if}
			    {/if}
			</div>
        </div>
	</div>
    <div class="bottom"></div>
</div>
<!--Wrapper End-->
{template member/footer}